home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Code Resources / Eclectic CDEFs / CDEF Utilities / StubCDEF Folder / StubCDEF.p < prev    next >
Text File  |  1997-02-27  |  1KB  |  48 lines

  1. {    StubCDEF:    Stub project to facilitate insertion and debugging of CDEFs in applications    }
  2. {}
  3. {    Copyright © Sebastiano Pilla 1996    }
  4. {    All rights reserved    }
  5. {    Original version Copyright © by Peter N. Lewis    }
  6. {}
  7. {    <mailto:case@tvol.it>    }
  8.  
  9. {    This StubCDEF must be compiled and saved like any other CDEF resource.    }
  10. {}
  11. {    When defining controls, StubCDEF behaves like a normal CDEF: the control definition ID must contain    }
  12. {    16 * (CDEF ID) + varCode, if the actual defproc requires variation codes.    }
  13. {    All other fields are specified by the real defproc documentation.    }
  14. {}
  15. {    At the control creation a ControlDefUPP pointing to the real defproc must be created and    }
  16. {    stored into the control's refCon: StubCDEF works by fetching that UPP and calling it. As it is,    }
  17. {    it assumes that the control's refCon is not used for anything else.    }
  18.  
  19. unit StubCDEF;
  20.  
  21.  
  22. interface
  23.  
  24.  
  25.     function Main (inVarCode: SInt16;
  26.                                     inControlHdl: ControlHandle;
  27.                                     inMessage: ControlDefProcMessage;
  28.                                     inParam: SInt32): SInt32;
  29.  
  30.  
  31. implementation
  32.  
  33.  
  34.     function Main (inVarCode: SInt16;
  35.                                     inControlHdl: ControlHandle;
  36.                                     inMessage: ControlDefProcMessage;
  37.                                     inParam: SInt32): SInt32;
  38.         var
  39.             ctrlDefUPP: ControlDefUPP;
  40.     begin
  41.         Main := 0;
  42.         ctrlDefUPP := ControlDefUPP(GetControlReference(inControlHdl));
  43.         if ctrlDefUPP <> nil then
  44.             Main := CallControlDefProc(inVarCode, inControlHdl, inMessage, inParam, ctrlDefUPP);
  45.     end;
  46.  
  47.  
  48. end.